Skip to content

Optimize NativeAOT delegate field layout#129304

Merged
jkotas merged 8 commits into
dotnet:mainfrom
MichalPetryka:naot-delegate-layout
Jun 13, 2026
Merged

Optimize NativeAOT delegate field layout#129304
jkotas merged 8 commits into
dotnet:mainfrom
MichalPetryka:naot-delegate-layout

Conversation

@MichalPetryka

@MichalPetryka MichalPetryka commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Placing the 2 fields used to call a delegate makes it less likely to split cache lines and makes every delegate call on arm64 smaller due to it being able to use ldp.
Diffs are here for x64 and here for arm64.

I'm planning to do a similar change for CoreCLR after #99200.

cc @MichalStrehovsky this was the arm64 size reduction I mentioned on Discord.

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 11, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

@jkotas

jkotas commented Jun 11, 2026

Copy link
Copy Markdown
Member

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment thread src/coreclr/nativeaot/System.Private.CoreLib/src/System/Delegate.cs Outdated
Comment thread src/coreclr/nativeaot/System.Private.CoreLib/src/System/Delegate.cs Outdated
Comment thread src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs Outdated
Comment thread src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs Outdated

@MichalStrehovsky MichalStrehovsky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jkotas

jkotas commented Jun 12, 2026

Copy link
Copy Markdown
Member

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkotas

jkotas commented Jun 12, 2026

Copy link
Copy Markdown
Member

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkotas

jkotas commented Jun 13, 2026

Copy link
Copy Markdown
Member

/ba-g armel build break that is fixed in main already, DeadLetter

@jkotas jkotas merged commit 1f254ec into dotnet:main Jun 13, 2026
128 of 137 checks passed
@MichalPetryka

Copy link
Copy Markdown
Contributor Author

@jkotas I'm wondering if it makes sense to unify the layout to be the same between CoreCLR and NAOT in the followup PR and make the field names the same to make code sharing easier, do you think I should do that after #99200?

@jkotas

jkotas commented Jun 13, 2026

Copy link
Copy Markdown
Member

Makes sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants